package com.grow.greenhouse.controller;

import com.grow.greenhouse.common.WebSocket;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RequestMapping("/webSocket")
@RestController
public class TestWebSocketController {

    @PostMapping("/sentMessage")
    public void sentMessage(@RequestParam String message) {
        try {
            WebSocket.sendInfo(message);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
